<html>
  <head>
    <script type="text/javascript">
        function callback()
        {
            if (window.name == "_GA_popupWindow") {
                var parts = window.location.href.slice(window.location.href.indexOf('oauth_token=') + 12).split('&');
                var oauth_token = URLDecode(parts[0]);
                window.opener.callbackFromPopup(oauth_token);
                window.close();
            }
        }

        function URLDecode (encodedString) {
          var output = encodedString;
          var binVal, thisString;
          var myregexp = /(%[^%]{2})/;
          while ((match = myregexp.exec(output)) != null
                     && match.length > 1
                     && match[1] != '') {
            binVal = parseInt(match[1].substr(1),16);
            thisString = String.fromCharCode(binVal);
            output = output.replace(match[1], thisString);
          }
          return output;
        }
    </script>
  </head>
  <body onload="callback();">
  </body>
</html>
